import 'package:cgvc/data/article_http.dart';
import 'package:cgvc/model/article_model.dart';
import 'package:dio/dio.dart';

class ArticleRepository {
  static Future getArticleList(
    String url, {
    String lastCursor,
    int pageSize: 20,
  }) async {
    Map<String, dynamic> param = lastCursor != null && lastCursor.isNotEmpty
        ? {
            "lastCursor": lastCursor,
            "pageSize": pageSize,
          }
        : null;
    Response response = await http.get(
      url,
      queryParameters: param,
    );
    return ArticleModel.fromJson(response.data);
  }
}
